#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

int un_g_val;
int g_val = 10;

int main(int argc, char* argv[], char* env[])
{
    char* str = "aaaaaaa";   // 这两个都不可以修改
    const char* str1 = "bbbbaaaaaaa";
    printf("string addr: %p\n",str);
    printf("read only string addr: %p\n",str1);
    printf("code addr: %p\n",main);
    printf("init addr: %p\n",&g_val);
    printf("un_init addr: %p\n",&un_g_val);

    static int test = 10;
    printf("static int addr: %p\n",&test);
    char* heap_mem = (char*)malloc(10);
    char* heap_mem1 = (char*)malloc(10);
    char* heap_mem2 = (char*)malloc(10);
    char* heap_mem3 = (char*)malloc(10);

    printf("heap_mem addr: %p\n",heap_mem);
    printf("heap_mem1 addr: %p\n",heap_mem1);
    printf("heap_mem2 addr: %p\n",heap_mem2);
    printf("heap_mem3 addr: %p\n",heap_mem3);

    printf("stack_mem addr: %p\n",&heap_mem);
    printf("stack_mem1 addr: %p\n",&heap_mem1);
    printf("stack_mem2 addr: %p\n",&heap_mem2);
    printf("stack_mem3 addr: %p\n",&heap_mem3);

    int i = 0;
    while(i < argc)
    {
        printf("argv[%d]: %p\n",i,argv[i]);
        i++;
    }
    int j = 0;
    while(env[j])
    {
        printf("env[%d]: %p\n",j,env[j]);
        j++;
    }
    
    
    return 0;
}
